<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link href="element/index.css" rel="stylesheet" />
		<script src="js/vue.js"></script>
		<script src="element/index.js"></script>
		<script src="js/axios.js"></script>
		<style>
			*{margin: 0;padding: 0;}
	
			html,
			body,
			#app,
			.el-container,
			.el-main {
				height: 100%;
				padding: 0;
				/* background-color: oldlace; */
			}
			
			
			.el-header{
				height: 70px !important;
				/* border: 1px solid #0000FF; */
				background-color: #FFFFFF;
				border-bottom:1px solid gainsboro;
			}
			.el-header .el-row{
				line-height: 70px;
			}
			.el-header img{
				width: 60px;
				height: 60px;
				vertical-align: middle;
			}
			.el-header h3{
				display: inline-block;
				font-size: 18px;
			}
			.el-menu-item{
				border-bottom: 1px solid gainsboro;
				background-color: #FFFFFF;
				color: #000000;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<el-container>
				<el-header>
					<el-row>
						<el-col :span=12>
							<img src="img/logo.jpeg" >
							<h3>甘肃农业大学信息科学技术学院教务系统</h3>
						</el-col>
						<el-col :span=12>
							<el-row type="flex" justify="end">
								<el-col :span=4 style="text-align: center;">你好！{{nickName}}</el-col>
								<el-col :span=4 style="text-align: center;">
									<el-button round @click="toSelf">个人中心</el-button>
								</el-col>
								<el-col :span=4 style="text-align: center;">
									<el-button round @click="toModifyPass">修改密码</el-button>
								</el-col>
								<el-col :span=3 style="text-align: center;">
									<el-button round @click="logout"><el-link style="width: 100%;" href="login.html" target="_self" :underline="false">退出</el-link></el-button>
								</el-col>
								<el-col :span=3 style="text-align: center;">
									<el-button round @click="toBangZhu">帮助</el-button>
								</el-col>
							</el-row>
						</el-col>
					</el-row>
				</el-header>
				<el-container>
					<!-- 左侧导航 -->
					<el-aside width="260px" style="background-color: #eef1f6">
						<el-menu id="navMenu" :default-openeds="['0']" :router="false" unique-opened>
							<el-menu-item index="0" @click="navToUserMange"><i class="el-icon-menu" ></i>{{yonghu}}</el-menu-item>
							<el-submenu v-if="data1.length>0" index="1" :collapse="true" >
								 <template slot="title"  >
								   <i class="el-icon-menu"></i>
								   <span>{{shenhe}}</span>
								 </template>
								 <el-menu-item-group>
								   <el-menu-item v-show="data1[0]===1" index="1-1" style="border-top: 1px solid gainsboro" @click="toLunwen"><i class="el-icon-s-grid"></i>论文发表</el-menu-item>
								   <el-menu-item v-show="data1[1]===2" index="1-2" @click="toHuoJiang"><i class="el-icon-s-grid"></i>获奖情况</el-menu-item>
								   <el-menu-item v-show="data1[2]===3" index="1-3" @click="toJiaoCai"><i class="el-icon-s-grid"></i>教材与专著</el-menu-item>
								   <el-menu-item v-show="data1[3]===4" index="1-4" @click="toJiaoGai"><i class="el-icon-s-grid"></i>教改项目</el-menu-item>
								   <el-menu-item v-show="data1[4]===5" index="1-5" @click="toKeYan"><i class="el-icon-s-grid"></i>科研项目</el-menu-item>
								   <el-menu-item v-show="data1[5]===6" index="1-6" @click="toRongYu"><i class="el-icon-s-grid"></i>荣誉称号</el-menu-item>
								   <el-menu-item v-show="data1[6]===7" index="1-7" @click="toJingSai"><i class="el-icon-s-grid"></i>指导竞赛</el-menu-item>
								   <el-menu-item v-show="data1[7]===8" index="1-8" @click="toZhuanLi"><i class="el-icon-s-grid"></i>专利及软著</el-menu-item>
								 </el-menu-item-group>
							</el-submenu>
							<el-menu-item index="2" style="border-top: 1px solid gainsboro"  @click="navToLunWen"><i class="el-icon-menu"></i>{{lunwen}}</el-menu-item>
							<el-menu-item index="3"  @click="navToHuoJiang"><i class="el-icon-menu"></i>{{huojiang}}</el-menu-item>
							<el-menu-item index="4"  @click="navToJiaoCaiYuZhuanZhu"><i class="el-icon-menu"></i>{{jiaocai}}</el-menu-item>
							<el-menu-item index="5"  @click="navToJiaoGai"><i class="el-icon-menu"></i>{{jiaogai}}</el-menu-item>
							<el-menu-item index="6"  @click="navToKeYan"><i class="el-icon-menu"></i>{{keyan}}</el-menu-item>
							<el-menu-item index="7"  @click="navToRongYu"><i class="el-icon-menu"></i>{{rongyu}}</el-menu-item>
							<el-menu-item index="8"  @click="navToJingSai"><i class="el-icon-menu"></i>{{zhidao}}</el-menu-item>
							<el-menu-item index="9"  @click="navToZhuanLiJiRuanZhu"><i class="el-icon-menu"></i>{{zhuanli}}</el-menu-item>
							<el-menu-item index="10"  @click="navToBaoBiao"><i class="el-icon-menu"></i>{{baobiao}}</el-menu-item>
							<el-menu-item index="11"  @click="navToDaoChu"><i class="el-icon-menu"></i>{{daochu}}</el-menu-item>
						</el-menu>
					</el-aside>
					<!-- 主区域 -->
					<el-main>
						<iframe :src="iframeSrc" frameborder="0" marginheight="8" marginwidth="8"
							style="display: block;width: 100%;height: 100%;"></iframe>
					</el-main>
				</el-container>
			</el-container>
		</div>
	</body>
</html>
<script>
	new Vue({
		el:"#app",
		data:{
			iframeSrc: "list.html",
			data1:[1,2,3,4,5,6,7,8],
			loginUser:{	},
			nickName:"",
			yonghu:"用户管理",
			shenhe:"审核",
			lunwen:"",
			huojiang:"",
			jiaocai:"",
			jiaogai:"",
			keyan:"",
			rongyu:"",
			zhidao:"",
			zhuanli:"",
			baobiao:"报表统计",
			daochu:"导出",
			config:{
				headers: {
					"token": ""
				}
			}
		},
		methods:{
			load() {
				
				axios.post('http://localhost:8080/user/getmenuanduser',{},this.config).then((res) => {
					console.log(res)
					if(res.data.code==200){
						this.huojiang=res.data.data.menu[0].name
						this.jiaocai=res.data.data.menu[1].name
						this.jiaogai=res.data.data.menu[2].name
						this.keyan=res.data.data.menu[3].name
						this.lunwen=res.data.data.menu[4].name
						this.rongyu=res.data.data.menu[5].name
						this.zhidao=res.data.data.menu[6].name
						this.zhuanli=res.data.data.menu[7].name
						this.loginUser = res.data.data
						this.nickName=res.data.data.user.nickName
					}else{
						window.location='login.html'
					}
				})
			},
			created:function(){
				this.config.headers.token = sessionStorage.getItem("token")
				this.load()
			},
			navToUserMange:function(){
				this.iframeSrc="yeMian/userMange/user.html"
			},
			navToShenHe:function(){
				this.iframeSrc="yeMian/shenHe/huojiangshenhelist.html"
			},
			navToLunWen:function(){
				this.iframeSrc="yeMian/lunWen/list.html"
			},
			navToHuoJiang:function(){
				// window.parent.location='../../index.html'
				this.iframeSrc="yeMian/huoJiang/list.html"
			},
			navToJiaoCaiYuZhuanZhu:function(){
				this.iframeSrc="yeMian/jiaoCaiYuZhuanZhu/list.html"
			},
			navToJiaoGai:function(){
				this.iframeSrc="yeMian/jiaoGai/list.html"
			},
			navToKeYan:function(){
				this.iframeSrc="yeMian/keYan/list.html"
			},
			navToRongYu:function(){
				this.iframeSrc="yeMian/rongYu/list.html"
			},
			navToJingSai:function(){
				this.iframeSrc="yeMian/jingSai/list.html"
			},
			navToZhuanLiJiRuanZhu:function(){
				this.iframeSrc="yeMian/zhuanLiJiRuanZhu/list.html"
			},
			navToBaoBiao:function(){
				this.iframeSrc="yeMian/baoBiao/baoBiao.html"
			},
			navToDaoChu:function(){
				this.iframeSrc="yeMian/daoChu/daoChu.html"
			},
			logout:function(){
				let token = sessionStorage.getItem("token")
				let config = {
					headers: {
						"token": token
					}
				};
				
				this.$confirm('是否退出系统？', '提示', {
				  confirmButtonText: '确定',
				  cancelButtonText: '取消',
				  type: 'warning'
				}).then(() => {
					
				  axios.post('http://localhost:8080/user/logout',{},this.config).then((res) => {
				  	console.log(res.data.data)
					sessionStorage.removeItem("token")
					window.location="login.html"
				  })
				  
				}).catch(() => {
					
				  this.$message({
					type: 'info',
					message: '已取消退出'
				  });          
				  
				});
			},
			toModifyPass:function(){
				this.iframeSrc="yeMian/xiuGaiMiMa/xiuGaiMiMa.html"
			},
			toSelf(){
				this.iframeSrc="yeMian/geRenZhongXin/geRenZhongXin.html"
			},
			toBangZhu:function(){
				this.iframeSrc="yeMian/bangZhu/bangZhu.html"
			},
			toLunwen(){
				this.iframeSrc="yeMian/shenHe/LunWen/LunWenList.html"
			},
			toHuoJiang(){
				this.iframeSrc="yeMian/shenHe/HuoJiang/huojiangshenhelist.html"
			},
			toJiaoCai(){
				this.iframeSrc="yeMian/shenHe/JiaoCai/shenhejiaocaizhuanzhu.html"
			},
			toJiaoGai(){
				this.iframeSrc="yeMian/shenHe/JiaoGai/jiaogailist.html"
			},
			toKeYan(){
				this.iframeSrc="yeMian/shenHe/HuoJiang/huojiangshenhelist.html"
			},
			toRongYu(){
				this.iframeSrc="yeMian/shenHe/HuoJiang/huojiangshenhelist.html"
			},
			toJingSai(){
				this.iframeSrc="yeMian/shenHe/JingSai/reviewList.html"
			},
			toZhuanLi(){
				this.iframeSrc="yeMian/shenHe/ZhuanLi/ShenHeList.html"
			}
		}
	})
</script>
